package com.sniper.model;

import com.sniper.annotation.FieldInfo;
import com.sniper.annotation.ID;
import com.sniper.constants.BaseConst;

import java.util.Date;

/**
 * @author suzhen
 */
public abstract class BaseEntity extends BaseToStringEntity {

    private static final long serialVersionUID = -2788075811594663611L;

    @ID
    @FieldInfo(desc = "主键ID")
    private String id;
    @FieldInfo(desc = "创建时间", dateFormat = BaseConst.DATE_TIME_FORMAT)
    private Date gmtCreate = new Date();
    @FieldInfo(desc = "修改时间", dateFormat = BaseConst.DATE_TIME_FORMAT)
    private Date gmtModified = new Date();
    @FieldInfo(desc = "数据版本")
    private Integer dataVersion = 1;

    @Override
    public String toString() {
        return super.toString();
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public Date getGmtCreate() {
        return gmtCreate;
    }

    public void setGmtCreate(Date gmtCreate) {
        this.gmtCreate = gmtCreate;
    }

    public Date getGmtModified() {
        return gmtModified;
    }

    public void setGmtModified(Date gmtModified) {
        this.gmtModified = gmtModified;
    }

    public Integer getDataVersion() {
        return dataVersion;
    }

    public void setDataVersion(Integer dataVersion) {
        this.dataVersion = dataVersion;
    }

    @Override
    public Object clone() throws CloneNotSupportedException {
        return super.clone();
    }

    public BaseEntity() {
    }

    public BaseEntity(String id) {
        this.id = id;
    }
}
